package core
{

	public class CardItemObject extends Object
	{
		private var _value:int;
		
		private var _color:int;
		public function CardItemObject(value:int,color)
		{
			super();
			this._value = value;
			this._color = color;
		}
		
		/**
		 * 这是一个变种的值
		 * 当为J,Q,K时都等于10
		 * 当为A的话等于11
		 */ 
		public function get value():int {
			if(this._value == 11 || this._value == 12 || this._value == 13){
				return 10;
			}
			if(this._value == 1){
				return 11;
			}
			return this._value;
		}
		
		public function get color():int {
			return this._color;
		}
		
		public function get frame():int {
			if(this._value == 1){
				return (color + 1) * Config.MAX_CARD_LENGTH;
			}
			return this._value + (color * Config.MAX_CARD_LENGTH) - 1;
		}
		
		public function get nValue():int {
			return this._value;
		}
		/**
		 * 是否是A 
		 * @return 
		 * 
		 */		
		public function get isA():Boolean {
			return this._value == 1;
		}
		
		public function equal(value:CardItemObject):Boolean {
			if(this.nValue == value.nValue){
				return true;
			}
			return false;
		}
	}
}